export const schema = {
    type: "page",
    title: "志愿者信息编辑",
    initApi: "/api/volunteer/${id}",
    body: [
        {
            type: "nav",
            stacked: false,
            links: [
                {
                    label: "查看",
                    to: "/volunteer/view/${id}"
                },
                {
                    label: "编辑",
                    to: "/volunteer/edit/${id}",
                },
                {
                    label: "参加的项目",
                    to: "/volunteer/project/${id}"
                },
                {
                    label: "参加的团队",
                    to: "/volunteer/team/${id}"
                }
            ]
        },

        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white no-padder",
            body: {
                className: "m-t-md",
                title: "",
                panelClassName: "no-border no-shadow m-b-none",
                api: "put:/api/volunteer/${id}",
                redirect: "/volunteer/view/${id}",
                submitText: "",
                type: "form",
                mode: "horizontal",
                actions: [
                    {
                        type: "button",
                        actionType: "submit",
                        label: "保存",
                        icon: "fa fa-save pull-left",
                        level: "info",
                    }
                ],
                controls: [
                    {
                        name: "username",
                        label: "昵称",
                        type: "static",
                    },
                    {
                        type: "static",
                        name: "identifier",
                        label: "志愿者编号",
                    },
                    [
                        {
                            name: "real_name",
                            label: "姓名",
                            type: "text",
                            maxLength: 32,
                            required: true
                        },
                        {
                            type: "text",
                            name: "id_number",
                            label: "身份证号",
                            validations: 'isIDStrict',
                            required: true
                        },
                    ],
                    {
                        type: "text",
                        name: "nation",
                        label: "民族",
                        maxLength: 32,
                        required: true
                    },
                    [
                        {
                            name: "sex",
                            label: "性别",
                            type: 'static',
                            tpl: "<%= data.sex === 1 ? '男' : data.sex === 2 ? '女' : '-' %>"
                        },

                        {
                            type: "static",
                            name: "age",
                            label: "年龄",
                        },
                    ],
                    {
                        type: "region",
                        name: "address",
                        label: "地址",
                        required: true
                    },
                    {
                        name: "phone",
                        label: "电话",
                        type: 'text',
                        validations: 'isPhone',
                        required: true
                    },
                    {
                        type: "password",
                        name: "pwd",
                        label: "密码",
                        validations: 'minLength:6',
                    },
                    [
                        {
                            type: "static",
                            name: "project_count",
                            label: "参加的项目数",
                        },
                        {
                            type: "static",
                            name: "team_count",
                            label: "参加的团队数",
                        },
                    ]
                ]
            }
        }
    ]
};
